package cn.haoshuai.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.haoshuai.entity.User;
@Repository("userDao")
@Transactional
public class UserDaoImp implements UserDao {
	@Resource
	HibernateTemplate ht;
	public User findUserByName(String name) {
		String sql = "from User where name = :name";
		List list = ht.findByNamedParam(sql, "name", name);
		if (list.isEmpty()) {
			return null;
		}
		return (User)list.get(0);
	}
	

}
